<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,user-scalable=no"/>
    <!-- <meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/> -->
    <link rel="stylesheet" href="./style/bootstrap.css">
    <link rel="stylesheet" href="./style/common.css">
    <script src="./js/jquery-3.5.1.js"></script>
    <title>首页</title>
</head>
<body>
    <!-- 主菜单 -->
    <div class="main">
        <!-- 导航栏 -->
        <!-- <div class="nav"> -->
            <!-- logo -->
            <!-- <div class="logo"> -->
                <!-- <img class="img-circle" src="./img/logo.png" alt="茂名寻星科技有限公司"> -->
                <!-- logo标签 -->
                <!-- <div class="n_label"><a href="">首页</a></div> -->
                <!-- <div class="n_label"><a href="">精选案例</a></div> -->
                <!-- <div class="n_label"><a href="">开发历史</a></div> -->
            <!-- </div> -->
            
        <!-- </div> -->
        <nav class="navbar navbar-inverse">
            <div class="container-fluid">
                <img class="img-circle" src="./img/logo.png" alt="茂名寻星科技有限公司">
              <!-- <div class="navbar-header">
                
                  <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>
                  <span class="icon-bar"></span>                       
                </button> 
                
              </div> -->
              <div class=" navbar-collapse" >
                <ul class="nav navbar-nav">
                   
                  <li class="active"><a href="#">首页</a></li>
                  <li><a href="#">精选案例</a></li>
                  <li><a href="#">开发历史</a></li>
                  
                </ul>
              </div>
            </div>
          </nav>
        <!-- 主要内容 -->
        <div class="content_center jumbotron container">
                     <div class="text">
                         <h1>茂名寻星科技有限公司</h1>
                         <h3>基本介绍</h3>
                         <p>功能</p>
                         <h4>多点</h4>
                     </div>
                     <div class="img">
                         <img class="img-rounded" src="./img/介绍1.jpg" alt="介绍1" style="width: 600px;height: 300px;">
                     </div>
        </div>
    </div>
    <div class="move">
        <div class="move_btn chosen">
            <h3 class="text-center ">企业背景</h3></div>
        <div class="move_btn">
            <h3 class="text-center">公司业务</h3></div>
        <div class="move_btn">
            <h3 class="text-center">开发团队</h3></div>
    </div>
    
    <!-- 企业背景 -->
    
        
    <div class="background">
        <h2 class="text-center texttop">企业背景</h2>
        <div class="jumbotron content_center container">
            <div class="img">
                <img class="img-rounded" src="./img/介绍1.jpg" alt="介绍1" style="width: 600px;height: 300px;">       
            </div>
            <div class="text">
                <h2>在哪</h2>
            </div>
        </div>
        <div class="jumbotron content_center container">
            <div class="img">
                <img class="img-rounded" src="./img/介绍1.jpg" alt="介绍1" style="width: 600px;height: 300px;">       
            </div>
            <div class="text">
                <h2>在哪</h2>
            </div>
        </div>
    </div>
    
    <!-- 公司业务 -->
    <div class="project">
        <h2 class="text-center texttop">公司业务</h2>
        <div class="jumbotron content_center container">
            <div class="img">
                <img class="img-rounded" src="./img/介绍1.jpg" alt="介绍1" style="width: 600px;height: 300px;">       
            </div>
            <div class="text">
                <h2>在哪</h2>
            </div>
        </div>
        <div class="jumbotron content_center container">
            <div class="img">
                <img class="img-rounded" src="./img/介绍1.jpg" alt="介绍1" style="width: 600px;height: 300px;">       
            </div>
            <div class="text">
                <h2>在哪</h2>
            </div>
        </div>
    </div>
    <!-- 开发团队 -->
    <div class="team">
        <h2 class="text-center texttop">开发团队</h2>
        <div class="jumbotron content_center container">
            <div class="img">
                <img class="img-rounded" src="./img/介绍1.jpg" alt="介绍1" style="width: 600px;height: 300px;">       
            </div>
            <div class="text">
                <h2>在哪</h2>
            </div>
        </div>
    </div>
</body>
<script>
$(function(){
    const currentY = document.documentElement.scrollTop || document.body.scrollTop
    const targetP=$(".project").offset().top;
    const targetT=$(".team").offset().top;

    function scrollAnimation(currentY, targetY) {       
     //currentY  当前滑动高度       targetY  目标滑动高度

    // 获取当前位置方法

    // const currentY = document.documentElement.scrollTop || document.body.scrollTop

    // 计算需要移动的距离

    let needScrollTop = targetY - currentY

    let _currentY = currentY

        setTimeout(() => {

            // 一次调用滑动帧数，每次调用会不一样

            const dist = Math.ceil(needScrollTop / 10)

            _currentY += dist

            window.scrollTo(_currentY, currentY)

            // 如果移动幅度小于十个像素，直接移动，否则递归调用，实现动画效果

            if (needScrollTop > 10 || needScrollTop < -10) {

                scrollAnimation(_currentY, targetY)

            } else {

                window.scrollTo(_currentY, targetY)

            }

        }, 1)

    }
    $(".move_btn:eq(1)").click( function () {
        $(this).addClass("chosen");
        $(".move_btn:eq(0)").removeClass("chosen");
        setTimeout(function () {
            scrollAnimation(currentY, targetP);
            $(".move_btn:eq(1)").removeClass("chosen");
            $(".move_btn:eq(0)").addClass("chosen");
        },1000)
        
        });
    $(".move_btn:eq(2)").click( function () {
        $(this).addClass("chosen");
        $(".move_btn:eq(0)").removeClass("chosen");
        setTimeout(function () {
            scrollAnimation(currentY, targetT);
            $(".move_btn:eq(2)").removeClass("chosen");
            $(".move_btn:eq(0)").addClass("chosen");
        },1000)
        
        });
    
        
})
</script>
</html>